/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Cursus.Listeners;

import java.awt.*;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import javax.swing.*;

/**
 *
 * @author sonicah
 */
public class mijnFrame extends JFrame {
    DefaultListModel lm = new DefaultListModel();
    public mijnFrame(String titel) {
        super(titel);
        Container c = this.getContentPane();
        c.setLayout(new FlowLayout());
        c.add(new JList(lm));

        this.setSize(120, 50);
        this.setVisible(true);
        addWindowListener(new WindowListener() {

            public void windowOpened(WindowEvent we) {
                lm.addElement("Window:Opened");
            }

            public void windowClosing(WindowEvent we) {
                lm.addElement("Window:Closing");
            }

            public void windowClosed(WindowEvent we) {
                lm.addElement("Window:Closed");
            }

            public void windowIconified(WindowEvent we) {
                lm.addElement("Window:Iconified");
            }

            public void windowDeiconified(WindowEvent we) {
                lm.addElement("Window:Deiconified");
            }

            public void windowActivated(WindowEvent we) {
                lm.addElement("Window:Activated");
            }

            public void windowDeactivated(WindowEvent we) {
                lm.addElement("Window:Deactivated");
            }
        });
    }
}
